<style scoped>
  .header{
    display: flex;
    flex-direction: column;
  }
  .head{
    height:50px;
    padding-top: 10px;
    display: flex;
    justify-content: center;
    align-items:center;
    background: #ffffff;
    box-shadow:0 2px 4px rgba(0,0,0,0.1);
    position: relative;
  }
  .head-left{
    position: absolute;
    width:40px;
    height:100%;
    left:0;
    top:0;
    color: #7f7a8e;
    text-align: center;
  }
  .head-left h1{
    margin-top: 22px;
  }
  .head-middle{
    font-size: 16px;
    color: #7f7a8e;
  }
  .head-right{
    position: absolute;
    right:14px;
    top:25px;
    color: #7f7a8e;
  }
  .open5{
    overflow: hidden;
  }
  .content{
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    color: #777287;
    background: #edf1f5;
  }
  .content>div{
    /*padding: 0 10px;*/
  }
  .first{
    width:100%;
  }

  .first>div{
    margin: 0 20px;

    background: #ffffff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /*padding:30px 0!important;*/
    position: relative;
  }
  .first>div>h1{
    position: absolute;
    bottom:0;
    left:0;
    right:0;
    display: flex;
    width: 100%;
    height:50px;
    align-items: center;
    justify-content: center;
    background: rgba(74,74,74,0.55);
  }
  .first>div>h1>h3{
    color: #ffffff;
  }
  .first>div>h1>h2{
    color: #3DD848;
  }
  .first>div>div{
    width:100%;
    height:100%;
    text-align: center;
    overflow: hidden;
  }
  .img{
    transform: rotate(270deg);
    transform-origin: center;
    height:100%;
    /*height:100%;*/
    /*width:100%;*/
  }

  .first>div>p{
    margin-top: 10px;
  }
  .first>div>div>i{
    font-size: 50px;
    color: #4D66FF;
    font-weight: 800;
  }
  .second{
    padding: 0 20px;
  }
  .third{
    padding: 0 20px;
  }
  .third{
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
  }
  /*.four{*/
  /*padding: 0 20px;*/
  /*}*/
  /*.four{*/
  /*display: flex;*/
  /*flex-direction: row;*/
  /*}*/
  @media screen and (max-width: 320px) {
    .five{
      height:35px;
    }
    .first>div{
      height:150px;
    }
    .img{
      width:150px;
      height: 190%;
      margin-top: -70px;
    }
  }
  @media screen and (max-width:375px) and (min-width:321px) {
    .five{
      height:39px;
    }
    .first>div{
      height:170px;
    }
    .img{
      width:170px;
      height: 190%;
      margin-top: -80px;
    }

  }
  @media screen and (min-width: 376px){
    .five{
      height:45px;
    }
    .first>div{
      height:190px;
    }
    .img{
      width:190px;
      height: 190%;
      margin-top: -86px;
    }
  }
  .five{
    padding: 0 10px;
    margin-bottom: 10px;
  }
  .five a{
    background: #435cff;
    border:none;
    border-radius: 4px;
    display: flex;
    justify-content:center;
    align-items: center;
    margin: 0 10px;
    height:100%;
  }
  .five h3{
    color: #ffffff;
  }
  .color{
    color: #4D66FF;
  }
  #sign i{
    font-size: 50px;
    color: #4D66FF;
  }
</style>

<template>
  <div class="open5" ref="sfz">
    <div class="header" style="position: fixed;top: 0;width: 100%;z-index: 999999;height: 60px;background: white">
      <div class="head">
        <div class="head-left" @click="goBack"><h1 class="iconfont icon-xiangzuo1"></h1></div>
        <div class="head-middle"><h3>宽策略证券开户</h3></div>
        <div class="head-right"  @click="contact"><h1 class="iconfont icon-kefu3"></h1></div>
      </div>
    </div>
    <div class="content" ref="content" style="margin-top: 61px;">
      <div class="first">
        <div @click="sign" id="sign">

          <div id="img">
            <img :src="imgUrl" alt="" v-if="sign2" class="img">
          </div>
          <i class="iconfont icon-jiahao1" v-if="sign1"></i>
          <p  v-if="!isSign" style="margin-bottom: 50px;">点击签署中文签名</p>
          <h1 v-if="isSign"><h2 class="iconfont icon-yuanxingxuanzhongfill"></h2><h3>中文签名上传成功</h3></h1>
        </div>
      </div>
      <div class="second">
        <p>本人声明:我授权宽策略证券使用以上签名,生成开户所需文件.以上签名与我手写签名具有同等法律效力.本人所填写的所有开户信息均真实准确并同意在内容有任何变化的情况下电话或邮件通知宽策略证券.必要时本人授权宽策略证券对资料的准确性进行修正.</p>
      </div>
      <div class="third">
        <h2 class="iconfont" :class="{'icon-fangxingweixuanzhong': isColor1,'icon-fangxingxuanzhongfill color': !isColor1}" @click="choose1">
        </h2>
        <p style="margin-left: 6px">本人不是法定的美国居民,旅客持有者或者ssn号码持有者.</p>
      </div>
      <div class="third">
        <h2 class="iconfont" :class="{'icon-fangxingweixuanzhong': isColor2,'icon-fangxingxuanzhongfill color': !isColor2}" @click="choose2">
        </h2>
        <p style="margin-left: 6px">本人及直系亲属不是登记证券经纪人,证券交易所,监管组织,证券或商品经济公司的员工,关联人员或利害关系人.</p>
      </div>
      <div class="third">
        <h2 class="iconfont" :class="{'icon-fangxingweixuanzhong': isColor3,'icon-fangxingxuanzhongfill color': !isColor3}" @click="choose3">
        </h2>
        <p style="margin-left: 6px">本人不是上市公司的董事,持10%股权的股东或最终决策人.</p>
      </div>
      <div class="third">
        <h2 class="iconfont" :class="{'icon-fangxingweixuanzhong': isColor4,'icon-fangxingxuanzhongfill color': !isColor4}" @click="choose4">
        </h2>
        <p style="margin-left: 6px">本人同意使用开户所填信息,生成W-8 BEN税务表格.</p>
      </div>
      <div class="third">
        <h2 class="iconfont" :class="{'icon-fangxingweixuanzhong': isColor5,'icon-fangxingxuanzhongfill color': !isColor5}" @click="choose5">
        </h2>
        <p style="margin-left: 6px">我同意提供个人信息给宽策略证券公司用于证券开户,已阅读并同意
          <router-link to="/agreement">《全部开户业务协议》</router-link>
        </p>
      </div>
      <div class="five" @click="next">
        <router-link to="">
          <h3>下一步</h3>
        </router-link>
      </div>
    </div>
  </div>
</template>

<script>
  import myKh from '../components/kh.vue'
  import {Toast} from 'mint-ui'
  import host from '../config'

  export default {
    components: {
      myKh,
      Toast
    },
    data () {
      return {
        isSign: false,
        isColor1: false,
        isColor2: false,
        isColor3: false,
        isColor4: false,
        isColor5: false,
        host: host,
        imgUrl: null,
        sign1: true,
        sign2: false
      }
    },
    mounted () {
      let h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
      let nanaH = h
      let nanaH1 = h - 50
      this.$refs.sfz.style.height = nanaH + 'px'
      this.$refs.content.style.height = nanaH1 + 'px'
      let signh = document.getElementById('sign').clientHeight
      let signw = document.getElementById('sign').clientWidth
      if(this.$store.state.sign === 1){
        this.isSign = true
        this.imgUrl = this.$store.state.signSuccess
        this.sign1 = false
        this.sign2 = true
      }else if(this.$store.state.openData.signImg) {
        this.isSign = true
        this.imgUrl = host.host + '/' + this.$store.state.openData.signImg
        this.sign1 = false
        this.sign2 = true
      }else{
        this.sign2 = false
      }
    },
    methods: {
      sign () {
        this.$router.push('/sign')
      },
      choose1 () {
        this.isColor1 = !this.isColor1
      },
      choose2 () {
        this.isColor2 = !this.isColor2
      },
      choose3 () {
        this.isColor3 = !this.isColor3
      },
      choose4 () {
        this.isColor4 = !this.isColor4
      },
      choose5 () {
        this.isColor5 = !this.isColor5
      },
      next () {
        if(this.isColor1 === true || this.isColor2 === true || this.isColor3 === true || this.isColor4 === true || this.isColor5 === true){
          Toast({
            message: '请勾选',
            duration: 1000
          })
          return
        }
        if(this.isSign !== true){
          Toast({
            message: '请签署中文签名',
            duration: 1000
          })
          return
        }else{
          if(!this.isColor1 &&  !this.isColor2 && !this.isColor3 && !this.isColor4 && !this.isColor5){
            this.$router.push('/accountSuccess')
          }
        }

      },
      goBack () {
        this.$router.push('./open4')
      },
      contact () {
        window.location.href = 'tel:400-900-6687'
      }
    }
  }
</script>
